/**
 * Cypress 类型扩展
 * 为测试中使用的自定义属性和方法提供类型定义
 */

declare global {
  interface Window {
    // 游戏相关的全局对象
    gameStore?: {
      score: number
      distance: number
      gameTime: number
      player: {
        isJumping: boolean
        isSliding: boolean
        currentLane: number
        jumpCount: number
      }
      currentCharacter: {
        id: string
      }
      coins: number
      settings: {
        masterVolume: number
        soundEnabled: boolean
        musicEnabled: boolean
        controlScheme: string
        controlSensitivity: number
        graphicsQuality: string
        particleEffects: boolean
        screenShake: boolean
        autoOptimization: boolean
        performanceMode: boolean
      }
      audioManager: {
        silentMode: boolean
      }
      storageManager: {
        memoryMode: boolean
      }
    }

    // 游戏引擎
    gameEngine?: {
      averageFPS: number
    }

    // 浏览器支持检测
    browserSupport?: {
      canvas: boolean
      webAudio: boolean
      localStorage: boolean
      requestAnimationFrame: boolean
    }
  }

  namespace Cypress {
    interface Chainable {
      /**
       * Tab 键导航
       */
      tab(): Chainable<JQuery<HTMLElement>>
    }
  }
}

// 扩展 Navigator 接口
declare global {
  interface Navigator {
    deviceMemory?: number
  }

  interface Performance {
    memory?: {
      usedJSHeapSize: number
      totalJSHeapSize: number
      jsHeapSizeLimit: number
    }
  }
}

export {}